3.5.21 \(\int (g+h x)^2 (a+b \log (c (d (e+f x)^p)^q)) \, dx\) [421]

Optimal. Leaf size=128 \[ -\frac {b (f g-e h)^2 p q x}{3 f^2}-\frac {b (f g-e h) p q (g+h x)^2}{6 f h}-\frac {b p q (g+h x)^3}{9 h}-\frac {b (f g-e h)^3 p q \log (e+f x)}{3 f^3 h}+\frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h} \]

[Out]

-1/3*b*(-e*h+f*g)^2*p*q*x/f^2-1/6*b*(-e*h+f*g)*p*q*(h*x+g)^2/f/h-1/9*b*p*q*(h*x+g)^3/h-1/3*b*(-e*h+f*g)^3*p*q*
ln(f*x+e)/f^3/h+1/3*(h*x+g)^3*(a+b*ln(c*(d*(f*x+e)^p)^q))/h

________________________________________________________________________________________

Rubi [A]
time = 0.10, antiderivative size = 128, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.115, Rules used = {2442, 45, 2495} \begin {gather*} \frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\frac {b p q (f g-e h)^3 \log (e+f x)}{3 f^3 h}-\frac {b p q x (f g-e h)^2}{3 f^2}-\frac {b p q (g+h x)^2 (f g-e h)}{6 f h}-\frac {b p q (g+h x)^3}{9 h} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(g + h*x)^2*(a + b*Log[c*(d*(e + f*x)^p)^q]),x]

[Out]

-1/3*(b*(f*g - e*h)^2*p*q*x)/f^2 - (b*(f*g - e*h)*p*q*(g + h*x)^2)/(6*f*h) - (b*p*q*(g + h*x)^3)/(9*h) - (b*(f
*g - e*h)^3*p*q*Log[e + f*x])/(3*f^3*h) + ((g + h*x)^3*(a + b*Log[c*(d*(e + f*x)^p)^q]))/(3*h)

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 2442

Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))*((f_.) + (g_.)*(x_))^(q_.), x_Symbol] :> Simp[(f + g*
x)^(q + 1)*((a + b*Log[c*(d + e*x)^n])/(g*(q + 1))), x] - Dist[b*e*(n/(g*(q + 1))), Int[(f + g*x)^(q + 1)/(d +
 e*x), x], x] /; FreeQ[{a, b, c, d, e, f, g, n, q}, x] && NeQ[e*f - d*g, 0] && NeQ[q, -1]

Rule 2495

Int[((a_.) + Log[(c_.)*((d_.)*((e_.) + (f_.)*(x_))^(m_.))^(n_)]*(b_.))^(p_.)*(u_.), x_Symbol] :> Subst[Int[u*(
a + b*Log[c*d^n*(e + f*x)^(m*n)])^p, x], c*d^n*(e + f*x)^(m*n), c*(d*(e + f*x)^m)^n] /; FreeQ[{a, b, c, d, e,
f, m, n, p}, x] &&  !IntegerQ[n] &&  !(EqQ[d, 1] && EqQ[m, 1]) && IntegralFreeQ[IntHide[u*(a + b*Log[c*d^n*(e
+ f*x)^(m*n)])^p, x]]

Rubi steps

\begin {align*} \int (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx &=\text {Subst}\left (\int (g+h x)^2 \left (a+b \log \left (c d^q (e+f x)^{p q}\right )\right ) \, dx,c d^q (e+f x)^{p q},c \left (d (e+f x)^p\right )^q\right )\\ &=\frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\text {Subst}\left (\frac {(b f p q) \int \frac {(g+h x)^3}{e+f x} \, dx}{3 h},c d^q (e+f x)^{p q},c \left (d (e+f x)^p\right )^q\right )\\ &=\frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\text {Subst}\left (\frac {(b f p q) \int \left (\frac {h (f g-e h)^2}{f^3}+\frac {(f g-e h)^3}{f^3 (e+f x)}+\frac {h (f g-e h) (g+h x)}{f^2}+\frac {h (g+h x)^2}{f}\right ) \, dx}{3 h},c d^q (e+f x)^{p q},c \left (d (e+f x)^p\right )^q\right )\\ &=-\frac {b (f g-e h)^2 p q x}{3 f^2}-\frac {b (f g-e h) p q (g+h x)^2}{6 f h}-\frac {b p q (g+h x)^3}{9 h}-\frac {b (f g-e h)^3 p q \log (e+f x)}{3 f^3 h}+\frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.11, size = 157, normalized size = 1.23 \begin {gather*} \frac {6 b e \left (3 f^2 g^2-3 e f g h+e^2 h^2\right ) p q \log (e+f x)+f x \left (6 a f^2 \left (3 g^2+3 g h x+h^2 x^2\right )-b p q \left (6 e^2 h^2-3 e f h (6 g+h x)+f^2 \left (18 g^2+9 g h x+2 h^2 x^2\right )\right )+6 b f^2 \left (3 g^2+3 g h x+h^2 x^2\right ) \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{18 f^3} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(g + h*x)^2*(a + b*Log[c*(d*(e + f*x)^p)^q]),x]

[Out]

(6*b*e*(3*f^2*g^2 - 3*e*f*g*h + e^2*h^2)*p*q*Log[e + f*x] + f*x*(6*a*f^2*(3*g^2 + 3*g*h*x + h^2*x^2) - b*p*q*(
6*e^2*h^2 - 3*e*f*h*(6*g + h*x) + f^2*(18*g^2 + 9*g*h*x + 2*h^2*x^2)) + 6*b*f^2*(3*g^2 + 3*g*h*x + h^2*x^2)*Lo
g[c*(d*(e + f*x)^p)^q]))/(18*f^3)

________________________________________________________________________________________

Maple [F]
time = 0.18, size = 0, normalized size = 0.00 \[\int \left (h x +g \right )^{2} \left (a +b \ln \left (c \left (d \left (f x +e \right )^{p}\right )^{q}\right )\right )\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((h*x+g)^2*(a+b*ln(c*(d*(f*x+e)^p)^q)),x)

[Out]

int((h*x+g)^2*(a+b*ln(c*(d*(f*x+e)^p)^q)),x)

________________________________________________________________________________________

Maxima [A]
time = 0.29, size = 207, normalized size = 1.62 \begin {gather*} -b f g^{2} p q {\left (\frac {x}{f} - \frac {e \log \left (f x + e\right )}{f^{2}}\right )} - \frac {1}{2} \, b f g h p q {\left (\frac {f x^{2} - 2 \, x e}{f^{2}} + \frac {2 \, e^{2} \log \left (f x + e\right )}{f^{3}}\right )} - \frac {1}{18} \, b f h^{2} p q {\left (\frac {2 \, f^{2} x^{3} - 3 \, f x^{2} e + 6 \, x e^{2}}{f^{3}} - \frac {6 \, e^{3} \log \left (f x + e\right )}{f^{4}}\right )} + \frac {1}{3} \, b h^{2} x^{3} \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + \frac {1}{3} \, a h^{2} x^{3} + b g h x^{2} \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + a g h x^{2} + b g^{2} x \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + a g^{2} x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)^2*(a+b*log(c*(d*(f*x+e)^p)^q)),x, algorithm="maxima")

[Out]

-b*f*g^2*p*q*(x/f - e*log(f*x + e)/f^2) - 1/2*b*f*g*h*p*q*((f*x^2 - 2*x*e)/f^2 + 2*e^2*log(f*x + e)/f^3) - 1/1
8*b*f*h^2*p*q*((2*f^2*x^3 - 3*f*x^2*e + 6*x*e^2)/f^3 - 6*e^3*log(f*x + e)/f^4) + 1/3*b*h^2*x^3*log(((f*x + e)^
p*d)^q*c) + 1/3*a*h^2*x^3 + b*g*h*x^2*log(((f*x + e)^p*d)^q*c) + a*g*h*x^2 + b*g^2*x*log(((f*x + e)^p*d)^q*c)
+ a*g^2*x

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 275 vs. \(2 (123) = 246\).
time = 0.36, size = 275, normalized size = 2.15 \begin {gather*} -\frac {6 \, b f h^{2} p q x e^{2} + 2 \, {\left (b f^{3} h^{2} p q - 3 \, a f^{3} h^{2}\right )} x^{3} + 9 \, {\left (b f^{3} g h p q - 2 \, a f^{3} g h\right )} x^{2} + 18 \, {\left (b f^{3} g^{2} p q - a f^{3} g^{2}\right )} x - 3 \, {\left (b f^{2} h^{2} p q x^{2} + 6 \, b f^{2} g h p q x\right )} e - 6 \, {\left (b f^{3} h^{2} p q x^{3} + 3 \, b f^{3} g h p q x^{2} + 3 \, b f^{3} g^{2} p q x + 3 \, b f^{2} g^{2} p q e - 3 \, b f g h p q e^{2} + b h^{2} p q e^{3}\right )} \log \left (f x + e\right ) - 6 \, {\left (b f^{3} h^{2} x^{3} + 3 \, b f^{3} g h x^{2} + 3 \, b f^{3} g^{2} x\right )} \log \left (c\right ) - 6 \, {\left (b f^{3} h^{2} q x^{3} + 3 \, b f^{3} g h q x^{2} + 3 \, b f^{3} g^{2} q x\right )} \log \left (d\right )}{18 \, f^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)^2*(a+b*log(c*(d*(f*x+e)^p)^q)),x, algorithm="fricas")

[Out]

-1/18*(6*b*f*h^2*p*q*x*e^2 + 2*(b*f^3*h^2*p*q - 3*a*f^3*h^2)*x^3 + 9*(b*f^3*g*h*p*q - 2*a*f^3*g*h)*x^2 + 18*(b
*f^3*g^2*p*q - a*f^3*g^2)*x - 3*(b*f^2*h^2*p*q*x^2 + 6*b*f^2*g*h*p*q*x)*e - 6*(b*f^3*h^2*p*q*x^3 + 3*b*f^3*g*h
*p*q*x^2 + 3*b*f^3*g^2*p*q*x + 3*b*f^2*g^2*p*q*e - 3*b*f*g*h*p*q*e^2 + b*h^2*p*q*e^3)*log(f*x + e) - 6*(b*f^3*
h^2*x^3 + 3*b*f^3*g*h*x^2 + 3*b*f^3*g^2*x)*log(c) - 6*(b*f^3*h^2*q*x^3 + 3*b*f^3*g*h*q*x^2 + 3*b*f^3*g^2*q*x)*
log(d))/f^3

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 286 vs. \(2 (112) = 224\).
time = 1.36, size = 286, normalized size = 2.23 \begin {gather*} \begin {cases} a g^{2} x + a g h x^{2} + \frac {a h^{2} x^{3}}{3} + \frac {b e^{3} h^{2} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{3 f^{3}} - \frac {b e^{2} g h \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{f^{2}} - \frac {b e^{2} h^{2} p q x}{3 f^{2}} + \frac {b e g^{2} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{f} + \frac {b e g h p q x}{f} + \frac {b e h^{2} p q x^{2}}{6 f} - b g^{2} p q x + b g^{2} x \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )} - \frac {b g h p q x^{2}}{2} + b g h x^{2} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )} - \frac {b h^{2} p q x^{3}}{9} + \frac {b h^{2} x^{3} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{3} & \text {for}\: f \neq 0 \\\left (a + b \log {\left (c \left (d e^{p}\right )^{q} \right )}\right ) \left (g^{2} x + g h x^{2} + \frac {h^{2} x^{3}}{3}\right ) & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)**2*(a+b*ln(c*(d*(f*x+e)**p)**q)),x)

[Out]

Piecewise((a*g**2*x + a*g*h*x**2 + a*h**2*x**3/3 + b*e**3*h**2*log(c*(d*(e + f*x)**p)**q)/(3*f**3) - b*e**2*g*
h*log(c*(d*(e + f*x)**p)**q)/f**2 - b*e**2*h**2*p*q*x/(3*f**2) + b*e*g**2*log(c*(d*(e + f*x)**p)**q)/f + b*e*g
*h*p*q*x/f + b*e*h**2*p*q*x**2/(6*f) - b*g**2*p*q*x + b*g**2*x*log(c*(d*(e + f*x)**p)**q) - b*g*h*p*q*x**2/2 +
 b*g*h*x**2*log(c*(d*(e + f*x)**p)**q) - b*h**2*p*q*x**3/9 + b*h**2*x**3*log(c*(d*(e + f*x)**p)**q)/3, Ne(f, 0
)), ((a + b*log(c*(d*e**p)**q))*(g**2*x + g*h*x**2 + h**2*x**3/3), True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 585 vs. \(2 (123) = 246\).
time = 3.48, size = 585, normalized size = 4.57 \begin {gather*} \frac {{\left (f x + e\right )} b g^{2} p q \log \left (f x + e\right )}{f} + \frac {{\left (f x + e\right )}^{2} b g h p q \log \left (f x + e\right )}{f^{2}} + \frac {{\left (f x + e\right )}^{3} b h^{2} p q \log \left (f x + e\right )}{3 \, f^{3}} - \frac {2 \, {\left (f x + e\right )} b g h p q e \log \left (f x + e\right )}{f^{2}} - \frac {{\left (f x + e\right )}^{2} b h^{2} p q e \log \left (f x + e\right )}{f^{3}} - \frac {{\left (f x + e\right )} b g^{2} p q}{f} - \frac {{\left (f x + e\right )}^{2} b g h p q}{2 \, f^{2}} - \frac {{\left (f x + e\right )}^{3} b h^{2} p q}{9 \, f^{3}} + \frac {2 \, {\left (f x + e\right )} b g h p q e}{f^{2}} + \frac {{\left (f x + e\right )}^{2} b h^{2} p q e}{2 \, f^{3}} + \frac {{\left (f x + e\right )} b h^{2} p q e^{2} \log \left (f x + e\right )}{f^{3}} + \frac {{\left (f x + e\right )} b g^{2} q \log \left (d\right )}{f} + \frac {{\left (f x + e\right )}^{2} b g h q \log \left (d\right )}{f^{2}} + \frac {{\left (f x + e\right )}^{3} b h^{2} q \log \left (d\right )}{3 \, f^{3}} - \frac {2 \, {\left (f x + e\right )} b g h q e \log \left (d\right )}{f^{2}} - \frac {{\left (f x + e\right )}^{2} b h^{2} q e \log \left (d\right )}{f^{3}} - \frac {{\left (f x + e\right )} b h^{2} p q e^{2}}{f^{3}} + \frac {{\left (f x + e\right )} b g^{2} \log \left (c\right )}{f} + \frac {{\left (f x + e\right )}^{2} b g h \log \left (c\right )}{f^{2}} + \frac {{\left (f x + e\right )}^{3} b h^{2} \log \left (c\right )}{3 \, f^{3}} - \frac {2 \, {\left (f x + e\right )} b g h e \log \left (c\right )}{f^{2}} - \frac {{\left (f x + e\right )}^{2} b h^{2} e \log \left (c\right )}{f^{3}} + \frac {{\left (f x + e\right )} b h^{2} q e^{2} \log \left (d\right )}{f^{3}} + \frac {{\left (f x + e\right )} a g^{2}}{f} + \frac {{\left (f x + e\right )}^{2} a g h}{f^{2}} + \frac {{\left (f x + e\right )}^{3} a h^{2}}{3 \, f^{3}} - \frac {2 \, {\left (f x + e\right )} a g h e}{f^{2}} - \frac {{\left (f x + e\right )}^{2} a h^{2} e}{f^{3}} + \frac {{\left (f x + e\right )} b h^{2} e^{2} \log \left (c\right )}{f^{3}} + \frac {{\left (f x + e\right )} a h^{2} e^{2}}{f^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)^2*(a+b*log(c*(d*(f*x+e)^p)^q)),x, algorithm="giac")

[Out]

(f*x + e)*b*g^2*p*q*log(f*x + e)/f + (f*x + e)^2*b*g*h*p*q*log(f*x + e)/f^2 + 1/3*(f*x + e)^3*b*h^2*p*q*log(f*
x + e)/f^3 - 2*(f*x + e)*b*g*h*p*q*e*log(f*x + e)/f^2 - (f*x + e)^2*b*h^2*p*q*e*log(f*x + e)/f^3 - (f*x + e)*b
*g^2*p*q/f - 1/2*(f*x + e)^2*b*g*h*p*q/f^2 - 1/9*(f*x + e)^3*b*h^2*p*q/f^3 + 2*(f*x + e)*b*g*h*p*q*e/f^2 + 1/2
*(f*x + e)^2*b*h^2*p*q*e/f^3 + (f*x + e)*b*h^2*p*q*e^2*log(f*x + e)/f^3 + (f*x + e)*b*g^2*q*log(d)/f + (f*x +
e)^2*b*g*h*q*log(d)/f^2 + 1/3*(f*x + e)^3*b*h^2*q*log(d)/f^3 - 2*(f*x + e)*b*g*h*q*e*log(d)/f^2 - (f*x + e)^2*
b*h^2*q*e*log(d)/f^3 - (f*x + e)*b*h^2*p*q*e^2/f^3 + (f*x + e)*b*g^2*log(c)/f + (f*x + e)^2*b*g*h*log(c)/f^2 +
 1/3*(f*x + e)^3*b*h^2*log(c)/f^3 - 2*(f*x + e)*b*g*h*e*log(c)/f^2 - (f*x + e)^2*b*h^2*e*log(c)/f^3 + (f*x + e
)*b*h^2*q*e^2*log(d)/f^3 + (f*x + e)*a*g^2/f + (f*x + e)^2*a*g*h/f^2 + 1/3*(f*x + e)^3*a*h^2/f^3 - 2*(f*x + e)
*a*g*h*e/f^2 - (f*x + e)^2*a*h^2*e/f^3 + (f*x + e)*b*h^2*e^2*log(c)/f^3 + (f*x + e)*a*h^2*e^2/f^3

________________________________________________________________________________________

Mupad [B]
time = 0.35, size = 225, normalized size = 1.76 \begin {gather*} \ln \left (c\,{\left (d\,{\left (e+f\,x\right )}^p\right )}^q\right )\,\left (b\,g^2\,x+b\,g\,h\,x^2+\frac {b\,h^2\,x^3}{3}\right )+x^2\,\left (\frac {h\,\left (a\,e\,h+2\,a\,f\,g-b\,f\,g\,p\,q\right )}{2\,f}-\frac {e\,h^2\,\left (3\,a-b\,p\,q\right )}{6\,f}\right )+x\,\left (\frac {3\,a\,f\,g^2+6\,a\,e\,g\,h-3\,b\,f\,g^2\,p\,q}{3\,f}-\frac {e\,\left (\frac {h\,\left (a\,e\,h+2\,a\,f\,g-b\,f\,g\,p\,q\right )}{f}-\frac {e\,h^2\,\left (3\,a-b\,p\,q\right )}{3\,f}\right )}{f}\right )+\frac {\ln \left (e+f\,x\right )\,\left (b\,p\,q\,e^3\,h^2-3\,b\,p\,q\,e^2\,f\,g\,h+3\,b\,p\,q\,e\,f^2\,g^2\right )}{3\,f^3}+\frac {h^2\,x^3\,\left (3\,a-b\,p\,q\right )}{9} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((g + h*x)^2*(a + b*log(c*(d*(e + f*x)^p)^q)),x)

[Out]

log(c*(d*(e + f*x)^p)^q)*((b*h^2*x^3)/3 + b*g^2*x + b*g*h*x^2) + x^2*((h*(a*e*h + 2*a*f*g - b*f*g*p*q))/(2*f)
- (e*h^2*(3*a - b*p*q))/(6*f)) + x*((3*a*f*g^2 + 6*a*e*g*h - 3*b*f*g^2*p*q)/(3*f) - (e*((h*(a*e*h + 2*a*f*g -
b*f*g*p*q))/f - (e*h^2*(3*a - b*p*q))/(3*f)))/f) + (log(e + f*x)*(b*e^3*h^2*p*q + 3*b*e*f^2*g^2*p*q - 3*b*e^2*
f*g*h*p*q))/(3*f^3) + (h^2*x^3*(3*a - b*p*q))/9

________________________________________________________________________________________